package org.example.configdemo.Controller;

import jakarta.annotation.PostConstruct;
import org.example.configdemo.model.DBTypes;
import org.example.configdemo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ymlController {
    @Value("${demo.key1}")
    public String key1;
    @Value("${demo.key2}")
    public String key2;

    @Value("${String.str1}")
    public String str1;
    @Value("${String.str2}")
    public String str2;
    @Value("${String.str3}")
    public String str3;


    @RequestMapping("/readYml")
    public String readYml() {
        return key1;
    }

    @Autowired
    public Student student;

    @Autowired
    public DBTypes dbTypes;


    @PostConstruct
    public void init() {
        //System.out.println("key1:"+key1);
        //System.out.println("key2:"+key2);
//        System.out.println("str1 = " + str1);
//        System.out.println("str2 = " + str2);
//        System.out.println("str3 = " + str3);

//        System.out.println(student);
          System.out.println(dbTypes);
    }
}
